/*
 * ToggleButtonDelegate.h  0.4.0 / Dec 04, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef TOGGLEBUTTONDELEGATE_H
#define TOGGLEBUTTONDELEGATE_H

#include "Cute4jSwing.h"

#include "AbstractButtonDelegate.h"

// ToggleButtonDelegate Class. -------------------------------------------------

/*!
 * \brief ToggleButton Delegate.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT ToggleButtonDelegate : public AbstractButtonDelegate
{
  Q_OBJECT
protected:
  ToggleButtonDelegate(JNIEnv *env, jobject obj, QAbstractButton *button);
  ToggleButtonDelegate(JNIEnv *env, jobject obj);
public slots: // native calls
  void setSelected(JNIEnv *env, jboolean selected);
public: // native calls
  static jlong newInstance(JNIEnv *env, jobject obj);
public:
  inline QPushButton *qToggleButton() const;
};

// ToggleButtonDelegate :: Public Inline Member Function. ----------------------

/*!
 * \brief Returns QPushButton adaptee.
 *
 * \return QPushButton adaptee
 */
inline QPushButton *ToggleButtonDelegate::qToggleButton() const
{
  return static_cast<QPushButton *>(qObject());
}

// Macro Definition. -----------------------------------------------------------

#define TOGGLE_BUTTON_DELEGATE \
    (reinterpret_cast<ToggleButtonDelegate *>(delegate))

#endif // TOGGLEBUTTONDELEGATE_H
